import { createRouter, createWebHistory, createWebHashHistory } from "vue-router";
import Layout from "@/layout/main.vue";

const routes = [
  {
    path: "/",
    component: Layout,
    redirect: "",
    children: [
      {
        path: "",
        name: "dashboard",
        component: () => import("@/views/dashboard/index.vue"),
      },
      // 子应用one-son
      {
        path: "/one-son",
        name: "one-son",
        children: [
          {
            path: "/one-son/user",
            name: "one-son-user",
            component: () => import("@/components/SubAppComponent.vue"),
          },
        ],
      },
      // 子应用two-son
      {
        path: "/two-son",
        name: "two-son",
        children: [
          {
            path: "/two-son/dept",
            name: "two-son-dept",
            component: () => import("@/components/SubAppComponent.vue"),
          },
        ],
      },
    ],
  },
];

const router = createRouter({
  routes,
  history: createWebHistory(),
});

/**
 * 全局前置守卫
 */
router.beforeEach((to, from) => {});

export default router;
